import javax.crypto.interfaces.PBEKey;

public class test {
    //数组遍历

    //数组转字符串
    public static void main(String[] args) {
        int [] arr={2,3,4,5,3};

    }

//    for-each遍历数组
    public static void main4(String[] args) {
        int [] arr={1,2,34,4};
        for (int x:arr) {
            System.out.println(x);
        }
    }
//     for循环遍历数组
    public static void main3(String[] args) {
        int [] arr ={1,2,3,4};
        for (int i = 0; i < arr.length; i++) {
            System.out.println(i);
        }
    }

    public static void main2(String[] args) {
        System.out.println(sum(1293));

    }
    public static int sum(int n){
        if(n<10){
            return n;
        }
        return n%10+sum(n/10);

    }
    public static void main1(String[] args) {
        print(123);
    }
    public static void print(int n) {
        if (n < 10) {
            System.out.println(n % 10);
            return;
        }
        print(n / 10);
        System.out.println(n%10);
    }
}
